package com.weixinli.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.weixinli.beans.Admin;
import com.weixinli.dao.IAdminDao;
@Repository("iAdminDao")
public class AdminDaoImpl implements IAdminDao{
	private SqlSession sqlSession;
	private IAdminDao iAdminDao;
	
	public int addAdmin(Admin ad) {
		return sqlSession.insert("addAdmin",ad);
	}

	public int delAdmin(Admin ad) {
		return sqlSession.delete("delAdmin",ad);
	}

	public int modAdmin(Admin ad) {
		return iAdminDao.delAdmin(ad);
	}

	public List<Admin> findAdmin() {
		return iAdminDao.findAdmin();
	}

	public Admin checkAdmin(Admin ad) {
		Admin admin=sqlSession.selectOne("checkAdmin", ad);
		return admin;
	}
	
	@Resource(name="sqlSession")
	public void setSqlSession(SqlSession sqlSession) {
		this.sqlSession = sqlSession;
	}
	
}
